﻿#ifndef DOU_GPU_INSTANCING
#define DOU_GPU_INSTANCING

// 矩阵缓冲
StructuredBuffer<float4x4> transformBuf;

/**
 * 获取 Instancing 的矩阵
 */
float4x4 GetInstancingTransform(const uint instanceId)
{
    return transformBuf[instanceId];
}

/**
 * 获取 Instancing 顶点世界坐标
 */
float4 GetInstancingWorldPosition(const float3 input, const uint instanceId)
{
    return mul(GetInstancingTransform(instanceId), float4(input.xyz, 1));
}

float4 GetInstancingWorldPosition(const float4 input, const uint instanceId)
{
    return mul(GetInstancingTransform(instanceId), input);
}

#endif
